/* eslint-disable */
import { hiprint } from "../js/index"

// 自定义设计元素1
export const aProvider = function(ops) {
  let addElementTypes = function(context) {
    context.removePrintElementTypes("aProviderModule")
    context.addPrintElementTypes(
      "aProviderModule",
      [
        new hiprint.PrintElementTypeGroup("寄件方信息", [

          {
            tid: "aProviderModule.companyName", title: "寄件公司", data: "赤壁市医药有限责任公司", type: "text",
            options: {
              testData: "赤壁市医药有限责任公司",
              height: 16,
              width: 200,
              field: "companyName",
              fontSize: 12,
              fontWeight: "700",
              textAlign: "left",
              hideTitle: false
            }
          },
          {
            tid: "aProviderModule.companyAddress", title: "详细地址", data: "详细地址", type: "text",
            options: {
              testData: "湖北省咸宁市赤壁市中伙铺镇高新区蛟龙桥路32号",
              height: 25,
              width: 335,
              field: "companyAddress",
              fontSize: 12,
              fontWeight: "700",
              textAlign: "left",
              hideTitle: false
            }
          }, {
            tid: "aProviderModule.outNickName", title: "寄件人", data: "管理员", type: "text",
            options: {
              testData: "管理员",
              title: "寄件人：",
              field: "outNickName",
              height: 25,
              fontSize: 12,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          }, {
            tid: "aProviderModule.mobile", title: "电话", data: "13555555555", type: "text",
            options: {
              testData: "13555555555",
              title: "电话：",
              field: "mobile",
              width: 150,
              height: 25,
              fontSize: 12,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          }
        ]),
        new hiprint.PrintElementTypeGroup("收件方信息", [

          {
            tid: "aProviderModule.customName", title: "收件公司", data: "湖北丹博瑞医药有限公", type: "text",
            options: {
              field: "customName",
              width: 200,
              testData: "湖北丹博瑞医药有限公",
              height: 16,
              fontSize: 12,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: "aProviderModule.customAddress", title: "详细地址", data: "湖北省咸宁市赤壁市中伙铺镇高新区蛟龙桥路32号", type: "text",
            options: {
              field: "customAddress",
              testData: "湖北省咸宁市赤壁市中伙铺镇高新区蛟龙桥路32号",
              height: 16,
              width: 335,
              fontSize: 12,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: "aProviderModule.customUserName", title: "收件人", data: "王莉", type: "text",
            options: {
              field: "customUserName",
              testData: "王莉",
              height: 16,
              fontSize: 12,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: "aProviderModule.customUserTel", title: "电话", data: "15888888888", type: "text",
            options: {
              field: "customUserTel",
              testData: "15888888888",
              height: 16,
              fontSize: 12,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          }
        ]),
        new hiprint.PrintElementTypeGroup("订单信息", [
          {
            tid: "aProviderModule.outOrderNo", title: "出库编号", data: "订单编号", type: "text",
            options: {
              field: "outOrderNo",
              testData: "XS888888888",
              height: 16,
              width: 150,
              fontSize: 12,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: "aProviderModule.drugsName", title: "货物名称", data: "货物名称", type: "text",
            options: {
              field: "drugsName",
              testData: "樟脑软膏",
              height: 16,
              width: 250,
              fontSize: 11,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: "aProviderModule.drugJsCount", title: "货物数量", data: "3", type: "text",
            options: {
              field: "drugJsCount",
              testData: "3",
              height: 16,
              width: 150,
              fontSize: 11,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: "aProviderModule.outDate", title: "出库日期", data: "2020-01-01", type: "text",
            options: {
              field: "outDate",
              testData: "2020-01-01",
              height: 16,
              fontSize: 6.75,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: "aProviderModule.nickName", title: "制单人", data: "李四", type: "text",
            options: {
              field: "nickName",
              testData: "李四",
              height: 16,
              fontSize: 6.75,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: "aProviderModule.printDate", title: "打印时间", data: "2022-01-01", type: "text",
            options: {
              field: "printDate",
              testData: "2022-01-01",
              height: 16,
              fontSize: 6.75,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          }
        ]),
        new hiprint.PrintElementTypeGroup("平台", [
          {
            tid: "aProviderModule.title", title: "单据表头", data: "单据表头", type: "text",
            options: {
              testData: "单据表头",
              height: 17,
              fontSize: 16.5,
              field: "title",
              fontWeight: "700",
              textAlign: "center",
              hideTitle: true
            }
          },
          {
            tid: "aProviderModule.barcode", title: "条形码", data: "XS888888888", type: "text",
            options: {
              field: "barcode",
              testData: "XS888888888",
              height: 32,
              fontSize: 12,
              lineHeight: 18,
              textType: "barcode"
            }
          },
          {
            tid: "aProviderModule.qrcode", title: "二维码", data: "XS888888888", type: "text",
            options: {
              field: "qrcode",
              testData: "XS888888888",
              height: 32,
              fontSize: 12,
              lineHeight: 18,
              textType: "qrcode"
            }
          },
          {
            tid: "aProviderModule.platform", title: "平台名称", data: "平台名称", type: "text",
            options: {
              testData: "平台名称",
              height: 17,
              fontSize: 16.5,
              fontWeight: "700",
              textAlign: "center",
              hideTitle: true
            }
          },
          { tid: "aProviderModule.logo", title: "图片", data: "", type: "image" },
          {
            tid: "aProviderModule.remark", title: "备注", data: "厂检、出库单", type: "text",
            options: {
              testData: "厂检、出库单",
              height: 17,
              fontSize: 12,
              field: "remark",
              fontWeight: "700",
              textAlign: "center",
              hideTitle: true
            }
          },
        ]),

        /*new hiprint.PrintElementTypeGroup("表格/其他", [
          {
            tid: 'aProviderModule.table', title: '订单数据',
            type: 'table',
            options: {
              field: 'table',
              tableHeaderRepeat: 'first',
              tableFooterRepeat: 'last',
              fields: [
                {text: '名称', field: 'NAME'},
                {text: '数量', field: 'SL'},
                {text: '规格', field: 'GG'},
                {text: '条码', field: 'TM'},
                {text: '单价', field: 'DJ'},
                {text: '金额', field: 'JE'},
              ],
            },
            editable: true,
            columnDisplayEditable: true,//列显示是否能编辑
            columnDisplayIndexEditable: true,//列顺序显示是否能编辑
            columnTitleEditable: true,//列标题是否能编辑
            columnResizable: true, //列宽是否能调整
            columnAlignEditable: true,//列对齐是否调整
            isEnableEditField: true, //编辑字段
            isEnableContextMenu: true, //开启右键菜单 默认true
            isEnableInsertRow: true, //插入行
            isEnableDeleteRow: true, //删除行
            isEnableInsertColumn: true, //插入列
            isEnableDeleteColumn: true, //删除列
            isEnableMergeCell: true, //合并单元格
            columns: [
              [
                {title: '名称', align: 'center', field: 'NAME', width: 150},
                {title: '数量', align: 'center', field: 'SL', width: 80},
                {title: '规格', align: 'center', field: 'GG', width: 80, checked: false},
                {title: '条码', align: 'center', field: 'TM', width: 100, checked: false},
                {title: '单价', align: 'center', field: 'DJ', width: 100},
                {title: '金额', align: 'center', field: 'JE', width: 100, checked: false},
              ],
            ],
            rowsColumnsMerge: function (data, col, index) {
              // 返回一个数组,参数一为行（rowspan）合并数,参数二为列（colspan）合并数, 被合并的行或者列值设为0
              if (index == 0) {
                return [1, data.INDEX % 2 == 1 ? 2 : 1]
              } else if (index > 0 && index < 2) {
                return [data.INDEX % 2 == 1 ? 0 : 1, 1]
              } else {
                return [data.INDEX % 2 == 1 ? 2 : 0, 1]
              }
            },
            footerFormatter: function (options, rows, data, currentPageGridRowsData) {
              if (data && data['totalCap']) {
                return `<td style="padding:0 10px" colspan="100">${'应收金额大写: ' + data['totalCap']}</td>`
              }
              return '<td style="padding:0 10px" colspan="100">应收金额大写: </td>'
            },
          },
          {tid: 'aProviderModule.customText', title: '文本', customText: '自定义文本', custom: true, type: 'text'},
          {
            tid: 'aProviderModule.longText', title: '长文本', type: 'longText', options: {
              field: 'test.longText',
              width: 200,
              testData: '长文本分页/不分页测试'
            },
          }
        ]),*/
        new hiprint.PrintElementTypeGroup("辅助", [
         
          {
            tid: "aProviderModule.hline",
            title: "横线",
            type: "hline"
          },
          {
            tid: "aProviderModule.vline",
            title: "竖线",
            type: "vline"
          },
          {
            tid: "aProviderModule.rect",
            title: "矩形",
            type: "rect"
          },
          {
            tid: "aProviderModule.oval",
            title: "椭圆",
            type: "oval"
          },
          {
            tid: "aProviderModule.barcode",
            title: "条形码",
            type: "barcode"
          },
          {
            tid: "aProviderModule.qrcode",
            title: "二维码",
            type: "qrcode"
          }
        ])
      ]
    )
  }
  return {
    addElementTypes: addElementTypes
  }
}

// 自定义设计元素2
export const bProvider = function(ops) {
  let addElementTypes = function(context) {
    context.removePrintElementTypes("bProviderModule")
    context.addPrintElementTypes(
      "bProviderModule",
      [
        new hiprint.PrintElementTypeGroup("寄件方信息", [
          {
            tid: "bProviderModule.companyName", title: "寄件公司", data: "赤壁市医药有限责任公司", type: "text",
            options: {
              testData: "赤壁市医药有限责任公司",
              height: 16,
              width: 200,
              field: "companyName",
              fontSize: 12,
              fontWeight: "700",
              textAlign: "left",
              hideTitle: false
            }
          },
          {
            tid: "bProviderModule.companyAddress", title: "详细地址", data: "详细地址", type: "text",
            options: {
              testData: "湖北省咸宁市赤壁市中伙铺镇高新区蛟龙桥路32号",
              height: 25,
              width: 335,
              field: "companyAddress",
              fontSize: 12,
              fontWeight: "700",
              textAlign: "left",
              hideTitle: false
            }
          }, {
            tid: "bProviderModule.outNickName", title: "寄件人", data: "管理员", type: "text",
            options: {
              testData: "管理员",
              title: "寄件人：",
              field: "outNickName",
              height: 25,
              fontSize: 12,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          }, {
            tid: "bProviderModule.mobile", title: "电话", data: "13555555555", type: "text",
            options: {
              testData: "13555555555",
              title: "电话：",
              field: "mobile",
              width: 150,
              height: 25,
              fontSize: 12,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          }
        ]),
        new hiprint.PrintElementTypeGroup("收件方信息", [

          {
            tid: "bProviderModule.customName", title: "收件公司", data: "湖北丹博瑞医药有限公", type: "text",
            options: {
              field: "customName",
              width: 200,
              testData: "湖北丹博瑞医药有限公",
              height: 16,
              fontSize: 12,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: "bProviderModule.customAddress", title: "详细地址", data: "湖北省咸宁市赤壁市中伙铺镇高新区蛟龙桥路32号", type: "text",
            options: {
              field: "customAddress",
              testData: "湖北省咸宁市赤壁市中伙铺镇高新区蛟龙桥路32号",
              height: 16,
              width: 335,
              fontSize: 12,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: "bProviderModule.customUserName", title: "收件人", data: "王莉", type: "text",
            options: {
              field: "customUserName",
              testData: "王莉",
              height: 16,
              fontSize: 12,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: "bProviderModule.customUserTel", title: "电话", data: "15888888888", type: "text",
            options: {
              field: "customUserTel",
              testData: "15888888888",
              height: 16,
              fontSize: 12,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          }
        ]),
        new hiprint.PrintElementTypeGroup("订单信息", [
          {
            tid: "bProviderModule.outOrderNo", title: "出库编号", data: "订单编号", type: "text",
            options: {
              field: "outOrderNo",
              testData: "XS888888888",
              height: 16,
              width: 150,
              fontSize: 12,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: "bProviderModule.drugsName", title: "货物名称", data: "货物名称", type: "text",
            options: {
              field: "drugsName",
              testData: "樟脑软膏",
              height: 16,
              width: 250,
              fontSize: 11,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: "bProviderModule.drugJsCount", title: "货物数量", data: "3", type: "text",
            options: {
              field: "drugJsCount",
              testData: "3",
              height: 16,
              width: 150,
              fontSize: 11,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: "bProviderModule.totalDrugJs", title: "总数量", data: "20", type: "text",
            options: {
              field: "totalDrugJs",
              testData: "10",
              height: 16,
              width: 150,
              fontSize: 11,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: "bProviderModule.outDate", title: "出库日期", data: "2020-01-01", type: "text",
            options: {
              field: "outDate",
              testData: "2020-01-01",
              height: 16,
              fontSize: 6.75,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: "bProviderModule.nickName", title: "制单人", data: "李四", type: "text",
            options: {
              field: "nickName",
              testData: "李四",
              height: 16,
              fontSize: 6.75,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          },
          {
            tid: "bProviderModule.printDate", title: "打印时间", data: "2022-01-01", type: "text",
            options: {
              field: "printDate",
              testData: "2022-01-01",
              height: 16,
              fontSize: 6.75,
              fontWeight: "700",
              textAlign: "left",
              textContentVerticalAlign: "middle"
            }
          }
        ]),
        /*new hiprint.PrintElementTypeGroup("表格/其他", [
          {
            tid: "bProviderModule.table", title: "订单数据",
            type: "table",
            options: {
              field: "table",
              fields: [
                { text: "名称", field: "NAME" },
                { text: "数量", field: "SL" },
                { text: "规格", field: "GG" },
                { text: "条码", field: "TM" },
                { text: "单价", field: "DJ" },
                { text: "金额", field: "JE" },
                { text: "备注", field: "DETAIL" }
              ]
            },
            editable: true,
            columnDisplayEditable: true,//列显示是否能编辑
            columnDisplayIndexEditable: true,//列顺序显示是否能编辑
            columnTitleEditable: true,//列标题是否能编辑
            columnResizable: true, //列宽是否能调整
            columnAlignEditable: true,//列对齐是否调整
            columns: [
              [
                { title: "名称", align: "center", field: "NAME", width: 100 },
                { title: "数量", align: "center", field: "SL", width: 100 },
                { title: "条码", align: "center", field: "TM", width: 100 },
                { title: "规格", align: "center", field: "GG", width: 100 },
                { title: "单价", align: "center", field: "DJ", width: 100 },
                { title: "金额", align: "center", field: "JE", width: 100 },
                { title: "备注", align: "center", field: "DETAIL", width: 100 }
              ]
            ],
            footerFormatter: function(options, rows, data, currentPageGridRowsData) {
              if (data && data["totalCap"]) {
                return `<td style='padding:0 10px' colspan='100'>${"应收金额大写: " + data["totalCap"]}</td>`
              }
              return "<td style=\"padding:0 10px\" colspan=\"100\">应收金额大写: </td>"
            }
          },
          { tid: "bProviderModule.customText", title: "文本", customText: "自定义文本", custom: true, type: "text" },
          {
            tid: "bProviderModule.longText", title: "长文本", type: "longText", options: {
              field: "test.longText",
              width: 200,
              testData: "长文本分页/不分页测试"
            }
          }
        ]),*/
        new hiprint.PrintElementTypeGroup("辅助", [
          {
            tid: "bProviderModule.hline",
            title: "横线",
            type: "hline"
          },
          {
            tid: "bProviderModule.vline",
            title: "竖线",
            type: "vline"
          },
          {
            tid: "bProviderModule.rect",
            title: "矩形",
            type: "rect"
          },
          {
            tid: "aProviderModule.barcode", title: "条形码", data: "CKA00260000002571", type: "text",
            options: {
              field: "barcode",
              testData: "CKA00260000002571",
              height: 32,
              fontSize: 12,
              lineHeight: 18,
              textType: "barcode"
            }
          },
          {
            tid: "bProviderModule.oval",
            title: "椭圆",
            type: "oval"
          }
        ])
      ]
    )
  }
  return {
    addElementTypes: addElementTypes
  }
}

//部门费用申请表设计元素
export const cProvider = function(ops) {
  let addElementTypes = function(context) {
    context.removePrintElementTypes("cProviderModule")
    context.addPrintElementTypes(
      "cProviderModule",
      [
        
        new hiprint.PrintElementTypeGroup("表格/其他", [
          {
            tid: "cProviderModule.table", title: "订单数据",
            type: "table",
            options: {
              field: "table"
            },
            editable: true,
            columnDisplayEditable: true,//列显示是否能编辑
            columnDisplayIndexEditable: true,//列顺序显示是否能编辑
            columnTitleEditable: true,//列标题是否能编辑
            columnResizable: true, //列宽是否能调整
            columnAlignEditable: true,//列对齐是否调整
            columns: [
              [
                { title: "名称", align: "center",  width: 100 },
                { title: "数量", align: "center",  width: 100 },
                { title: "条码", align: "center",  width: 100 },
                { title: "规格", align: "center",  width: 100 },
                { title: "单价", align: "center",  width: 100 },
                { title: "金额", align: "center", width: 100 },
                { title: "备注", align: "center", width: 100 }
              ]
            ],
            footerFormatter: function(options, rows, data, currentPageGridRowsData) {
              if (data && data["totalCap"]) {
                return `<td style='padding:0 10px' colspan='100'>${"应收金额大写: " + data["totalCap"]}</td>`
              }
              return "<td style=\"padding:0 10px\" colspan=\"100\">应收金额大写: </td>"
            }
          },
          { tid: "cProviderModule.customText", title: "文本", customText: "自定义文本", custom: true, type: "text" },
          {
            tid: "cProviderModule.longText", title: "长文本", type: "longText", options: {
              field: "test.longText",
              width: 200,
              testData: "长文本分页/不分页测试"
            }
          }
        ]),
        new hiprint.PrintElementTypeGroup("辅助", [
          {
            tid: "cProviderModule.hline",
            title: "横线",
            type: "hline"
          },
          {
            tid: "aProviderModule.barcode", title: "条形码", data: "XS888888888", type: "text",
            options: {
              field: "barcode",
              testData: "XS888888888",
              height: 32,
              fontSize: 12,
              lineHeight: 18,
              textType: "barcode"
            }
          },
          {
            tid: "cProviderModule.vline",
            title: "竖线",
            type: "vline"
          },
          {
            tid: "cProviderModule.rect",
            title: "矩形",
            type: "rect"
          },
          {
            tid: "cProviderModule.oval",
            title: "椭圆",
            type: "oval"
          }
        ])
      ]
    )
  }
  return {
    addElementTypes: addElementTypes
  }
}

// type: 1出库单 2商品标签
export default [{
  name: "出库单",
  value: "aProviderModule",
  type: 1,
  f: aProvider()
}, {
  name: "商品标签",
  value: "bProviderModule",
  type: 2,
  f: bProvider()
}, {
  name: "部门费用申请申请表",
  value: "cProviderModule",
  type: 3,
  f: cProvider()
}]
